home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
n_b_v203.zip
/
PERCENTT.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
4KB
|
80 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME PERCENTT.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB01.INC"
$INCLUDE "DAS-NBT1.INC"
COLOR 7, 0
CLS
? "┌───────────────────────────────────────────────────────────────────────
? "│ PerCentBarT ( Row?, Col?, Done&, Total&, Attr? )
? "├───────────────────────────────────────────────────────────────────────
? "│ Here's one to play with. It will have to be mushed around to make it
? "│ work intelligently in your programs but it's short and should pose
? "│ no problems. I've put both the bar and the whirly-gig in the same
? "│ routine but I usually use only one or the other and sometimes I print
? "│ the actual percentage on the screen under the bar; it just depends on
? "│ the program.
? "└───────────────────────────────────────────────────────────────────────
MakeTBox 13, 10, 5, 30, 1, 31, 21, 7, 0, ""
TprintCENTER 14, 11, 28, "Percentage Bar", 30
TBoxFILL 16, 12, 1, 25, 32, 112
MaxNumber% = 200
FOR Done% = 1 TO MaxNumber%
SetDELAY 24
PerCentBarT 16, 12, Done%, MaxNumber%, 116
EndDELAY
IF INSTAT THEN EXIT FOR
NEXT
' ────────────────────────────────────────────────────────────────────────
' ─────────── everything below here can be put into a .PBU ───────────────
' ────────────────────────────────────────────────────────────────────────
DECLARE SUB Tprint (BYVAL Row?,BYVAL Col?,BYVAL V$,BYVAL Attr?)
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
' PURPOSE: print a per-centage bar and whirly-gig on the screen
' PARAMS: Row? row for %bar
' Col? starting column ( 26 columns used )
' Done& number of items "done"
' Total& total number of items
' Attr? color attribute
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
SUB PerCentBarT (BYVAL Row?,BYVAL Col?,BYVAL Done&,BYVAL Total&,BYVAL Attr?) LOCAL PUBLIC
STATIC C%
LOCAL D$, L%, W%
'┌────────────────────
INCR C%, 1 : IF C% > 4 THEN C% = 1 '│ 4 part whirly-gig
Tprint Row?, Col? + 25, MID$( "\|/─", C%, 1 ), Attr? '│ print it!
'├────────────────────
L% = CINT( 50 * ( Done& / Total& ) ) '│ 25 chars of the
W% = ( L% MOD 2 ) '│ bar but using "▌"
L% = ( L% \ 2 ) '│ to increase it to
IF L% > 0 THEN D$ = STRING$( L%, 219 ) '│ a total of 50.
IF W% > 0 THEN D$ = D$ + MID$( "▌", W%, 1 ) '│
Tprint Row?, Col?, D$, Attr? '│
'└────────────────────
END SUB